<?php /*a:2:{s:54:"F:\tp-layui\tp5\application\admin\view\exam\list1.html";i:1621235334;s:55:"F:\tp-layui\tp5\application\admin\view\public\base.html";i:1620829072;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台管理系统</title>
    <link rel="stylesheet" href="/static/layui/layui/css/layui.css">

</head>

<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo">我的后台管理系统</div>
            <!-- 头部区域航） -->
             <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item  
                "><a href="<?php echo url('admin/admin/admin'); ?>"><i class="layui-icon layui-icon-home">&nbsp;&nbsp;</i>首页</a></li>
                <!-- <li class="layui-nav-item"><a href="">nav 2</a></li>
                <li class="layui-nav-item"><a href="">nav 3</a></li> -->
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-set">&nbsp;&nbsp;</i>其他系统</a>
                    <dl class="layui-nav-child">
                        <dd><a href="">邮件管理</a></dd>
                        <dd><a href="">消息管理</a></dd>
                        <dd><a href="">授权管理</a></dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img"> 用户
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="">基本资料</a></dd>
                        <dd><a href="">退出登录</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="">登录</a></li>
            </ul>
        </div>

        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域 -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item ">
                        <a class="" href="javascript:;"><i class="layui-icon layui-icon-user">&nbsp;&nbsp;</i>用户管理</a>
                        <dl class="layui-nav-child">
                            <dd class=" 
                            "><a href="javascript:;">管理员</a></dd>
                            <dd class=" 
                                "><a href="<?php echo url('admin/user/listcy'); ?>">学员管理</a></dd>
                            <!-- <dd><a href="javascript:;">menu item 1-3</a></dd>
                            <dd><a href="">the links</a></dd> -->
                        </dl>
                    </li>
                    <li class="layui-nav-item layui-nav-itemed">
                        <a href="javascript:;"><i class="layui-icon layui-icon-read ">&nbsp;&nbsp;</i>试题管理</a>
                        <dl class="layui-nav-child">
                            <dd class="{layui-this}"><a href="<?php echo url('admin/exam/list1'); ?>">试题列表</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item 
                        
                     "><a href="javascript:;"><i class="layui-icon layui-icon-dialogue">&nbsp;&nbsp;</i>留言管理</a></li>

                </ul>
            </div>
        </div>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">
<div class="demoTable">
    搜索试题
    <div class="layui-inline">
        <input class="layui-input" name="value" id="examval" autocomplete="off">
    </div>
    <button class="layui-btn" data-type="reload" id="examsearch">搜索</button>
</div>
<table id="user1" lay-filter="user1" class="layui-bg-green"></table>


            </div>
        </div>

        <div class="layui-footer">
            <!-- 底部固定区域 -->
            底部固定区域
        </div>
    </div>

    <script src="/static/layui/layui/layui.js"></script>
    <script>
        //JavaScript代码区域
        layui.use('element', function() {
            var element = layui.element;

        });
    </script>
    
<script text="text/javascript">
    layui.use('table', function () {
        var table = layui.table;
        var $ = layui.$;
        table.render({
            elem: '#user1',
            height:450,
            url: '<?php echo url("admin/Exam/getExamData"); ?>',
            cols: [
                [{
                    field: 'id',
                    width: 80,
                    title: 'ID',
                    sort: true
                }, {
                    field: 'examname',
                    title: '试题标题',
                },{
                    field: 'username',
                    title: '上传用户',

                },{
                     field: 'course',
                    title: '科目',
                },
                {
                     field: 'type',
                    title: '类型',
                },
                {
                     field: 'grade',
                    title: '年级',
                },
                {
                    field: 'file',
                    title: '查看',  
                    templet:function(d){
                        return '<a href="/static/uploads/'+d.username+'/'+d.file+' ">'+d.file+'</a>'
                    }
                }, {
                    field: 'status',
                    title: '状态',
                    edit: "text",
                    templet: function (d) {
                        if (d.status == 2) {
                            return '<span style="color:green">审核通过</span>';
                        } else if(d.status==1){  
                            return '<span style="color:blue">未审核</span>';
                        }else{
                            return '<span style="color:red">不通过</span>';
                        }
                    }
                }, {
                    field: 'create_time',
                    title: '申请时间',
                    sort: true
                }, ]
            ],
            page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'],
                limit: 4, //每个表格显示几条记录
                limits: [5, 10, 15], //每页显示几条
                groups: 3, //显示一个连续页码
                first: true, //不显示首页   
                last: false, //不显示尾页 
            },
            id: 'idExam'
        });


        $('#examsearch').click(function() {
            table.reload('idExam', {
                where: { //设定异步数据接口的额外参数，任意设
                    value: $('#examval').val()
                },
                page: {
                    cur: 1 //重新从第 1 页开始
                }
            }); //只重载数据

        })
        table.on('edit(Exam)', function(obj) {
            var value = obj.value, //修改后的值
                data = obj.data, //得到所在行的键值 
                field = obj.field; //字段
            // layer.msg('[ID:' + data.id + '] ' + field + ' 字段更改为 ' + value);
            // layer.confirm("确认修改" + '[ID:' + data.id + '] ' + field + ' 字段更改为 ' + value, function() {
            layer.confirm("真的要修改么？", function() {
                $.ajax({
                    type: "get",
                    url: "<?php echo url('admin/user/edit'); ?>",
                    // data: "id=" + data.id + "&field=" + field + "&value" + value
                    data: data,
                    dataType: "json",
                    success: function(data) {
                        if (data.code == 200) {
                            layer.msg(data.msg, {
                                time: 500
                            }, function() {
                                window.location.reload();
                            })
                        } else {
                            layer.msg(data.msg, {
                                time: 1000
                            }, function() {
                                window.location.reload();

                            })
                        }
                    }
                })
            })
        });

    });

</script>

</body>

</html>